package top.lyf1210.yuwenpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.multipart.MultipartFile;
import top.lyf1210.yuwenpicturebackend.model.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import top.lyf1210.yuwenpicturebackend.model.User;
import top.lyf1210.yuwenpicturebackend.model.dto.picture.*;
import top.lyf1210.yuwenpicturebackend.model.vo.picture.PictureVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author 钰玟
* @description 针对表【t_picture(图片)】的数据库操作Service
* @createDate 2025-04-17 14:10:32
*/
public interface PictureService extends IService<Picture> {

    /**
     * 上传图片
     * @param inputSource 图片文件
     * @param pictureUploadDTO dto
     * @param loginUser 操作用户
     * @return
     */
    PictureVO uploadPicture(Object inputSource, PictureUploadDTO pictureUploadDTO,User loginUser);

    /**
     * 分页查询
     * @param pictureQueryDTO 查询数据dto
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryDTO pictureQueryDTO);


    /**
     * 获取图片的 vo对象
     * @param picture picture
     * @param request request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage,HttpServletRequest request);

    void validPicture(Picture picture);

    /**
     * 图片审核
     *
     * @param pictureReviewDTO
     * @param loginUser
     */
    void doPictureReview(PictureReviewDTO pictureReviewDTO, User loginUser);


    void fillReviewParams(Picture picture,User loginUser);

    Integer pictureUploadByBatch(PictureUploadByBatchDTO pictureUploadByBatchDTO, User loginUser);


    void clearPictureFile(Picture oldPicture);


    void checkPictureAuth(User loginUser,Picture picture);

    Boolean deletePicture(Long pictureId, User loginUser);

    Boolean editPicture(PictureEditDTO pictureEditDTO, User loginUser);
    List<PictureVO> searchPictureByColor(Long spaceId, String picColor, User loginUser);

    /**
     * 刷新图片颜色
     * @param spaceId 空间id
     * @param loginUser 用户
     * @return
     */
    boolean flushPictureColor(Long spaceId, User loginUser);

    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);
}
